
package hibernateUtil;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateSessionFactory {
    private static SessionFactory factory;
    
    public static void createSessionFactory(){
	AnnotationConfiguration cfg = new AnnotationConfiguration();
	cfg.configure("hibernate.cfg.xml").buildSessionFactory() ;
	factory=cfg.buildSessionFactory(); 
    }
    
    public static SessionFactory getSessionFactory(){
	return factory;
    }
    
    public static void closeSessionFactory(){
        factory.close();
    }
}
